﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <style type="text/css">
        th, td
        {
            text-align: center;
        }
    </style>
    <script type="text/javascript">
        var frmID;
        var fk_flow;
        var fk_Node;
        $(function () {

            frmID = GetQueryString("FK_MapData");
            fk_flow = GetQueryString("FK_Flow");
            fk_Node = GetQueryString("FK_Node");

            var dtls = new Entities("BP.Sys.MapDtls");
            dtls.Retrieve("FK_MapData", frmID);

            var html = "";

            for (var i = 0; i < dtls.length; i++) {

                var dtl = dtls[i];

                html += "<tr >";
                html += "<td>" + dtl.No + "</td>";
                html += "<td>" + dtl.Name + "</td>";

                html += "<td><a href=\"javascript:EditDtlYuanShi('" + frmID + "','" + dtl.No + "')\">原始属性</a></td>";
                html += "<td><a href=\"javascript:EditDtl('" + fk_Node + "','" + frmID + "','" + dtl.No + "')\">自定义属性</a></td>";
                html += "<td><a href=\"javascript:DeleteDtl('" + fk_Node + "','" + frmID + "','" + dtl.No + "')\"><img src='../../Img/Btn/Delete.gif' />删除</a></td>";
                html += "</tr>";
            }

            $("#Table1 tr:last").after(html);
        });

        //编辑从表的原始属性.
        function EditDtlYuanShi(fk_mapdata, dtlKey) {
            // var url = '../../Comm/En.htm?EnName=BP.WF.Template.MapDtlExt&PK=' + dtlKey;

            var url = "../FoolFormDesigner/MapDefDtlFreeFrm.htm?FK_MapData=" + fk_mapdata + "&FK_MapDtl=" + dtlKey;
            //  http: //localhost:9958/WF/Admin/FoolFormDesigner/MapDefDtlFreeFrm.htm?FK_MapData=YYT_XQ_SQ&FK_MapDtl=YYT_XQ_SQDtl2
            WinOpen(url);
        }

        //编辑从表在该节点自定义权限.
        function EditDtl(fk_node, fk_mapdata, dtlNo) {

            var mypk = dtlNo + '_' + fk_Node;
            var en = new Entity("BP.WF.Template.MapDtlExt");
            en.SetPKVal(mypk);
            if (en.RetrieveFromDBSources() == 0) {

                en.SetPKVal(dtlNo);
                en.RetrieveFromDBSources(); //查询.

                en.SetPKVal(mypk);
                en.FK_Node = fk_Node; //设置FK_Node.
                en.FK_MapData = fk_mapdata + "_" + fk_node; //原来的错误.
                en.No = mypk;
                en.Insert();
                 en.DoMethodReturnString("InitAttrsOfSelf");

            } else {

                //  alert(en.FK_MapData);

                if (en.FK_MapData != fk_mapdata + "_" + fk_node) {
                    en.FK_MapData = fk_mapdata + "_" + fk_node
                    en.Update();
                }
            }

            window.location.href = window.location.href;
            //var url = '../../Comm/En.htm?EnName=BP.WF.Template.MapDtlExt&FK_MapData=' + fk_mapdata + '&No=' + mypk + '&FK_Node=' + fk_node;

            var url = "../FoolFormDesigner/MapDefDtlFreeFrm.htm?FK_MapData=" + fk_mapdata + "_" + fk_node + "&FK_MapDtl=" + mypk + "&FK_Node=" + fk_Node;
            WinOpen(url);

            //var b = window.showModalDialog(url, 'ass', 'dialogHeight: 600px; dialogWidth: 700px;center: yes; help:no;resizable:yes');
            //window.location.href = window.location.href;
        }

        //删除从表在节点中的权限控制.
        function DeleteDtl(fk_node, fk_mapdata, dtl) {
            if (confirm('您确定要删除该控件在当前节点的权限控制吗？') == false)
                return;
            var mypk = dtl + '_' + fk_node;
            var en = new Entity("BP.WF.Template.MapDtlExt");
            en.No = mypk;
            en.Delete();
            alert("删除成功!");
            window.location.href = window.location.href;
        }
    </script>
</head>
<body onkeypress="Esc();">
    <table id="Table1" class="table tableizer-table  table-striped table-bordered table-hover table-condensed">
        <caption>
            节点-表单-从表权限
        </caption>
        <tr>
            <td> 编号</td>
            <td> 名称 </td>
            <td>原始属性 </td>
            <td>自定义属性 </td>
            <td> 删除</td>
        </tr>
    </table>
</body>
</html>
